import pygame

import player
import baddies

import items

import world
import terrain

import menu
import hud

import music

import data

from constants import *
from config    import CONFIG

import random


class GeneralFactory:
  def __init__(self):
    self.images = {}
    self.sounds = {}
    
    self.images['Player']  = data.load_player_images('trixie')
    self.images['Terrain'] = data.load_terrain_images('grass')
  
  def make_player(self,pos,name):
    del self.images['Player']
    
    self.images['Player'] = data.load_player_images(name)
    
    return player.Player(pos,(10,10),self.images['Player'],{})
  
  def make_terrain_tile(self,pos,category,name):
    tile = None
    
    if random.random() < 0.75:
      tile = terrain.TerrainTile(pos,self.images['Terrain'][category][name][0])
    else:
      tile = terrain.TerrainTile(pos,self.images['Terrain'][category][name][random.randint(0,5)])
    
    return tile
  
  def inflate_world_segment(self,data):
    random.seed(23)
  
